/*
 * DespesaBusinessDelegate.java
 *
 * Created on 15 de Julho de 2007, 17:58
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.finance.presentation.delegate;

import br.unifor.finance.common.business.entity.Despesa;
import br.unifor.finance.common.business.service.DespesaService;
import br.unifor.finance.presentation.delegate.exceptions.BusinessDelegateException;
import br.unifor.finance.presentation.servicelocator.ServiceLocator;
import java.util.Collection;

/**
 *
 * @author Cleilson
 */
public class DespesaBusinessDelegate extends AbstractBusinessDelegate<Despesa, Integer> {
  
  private static DespesaBusinessDelegate instance;
  
  private ServiceLocator locator = ServiceLocator.getInstance();
  private DespesaService service = locator.lookupDespesaService();  
  
  /**
   * Creates a new instance of DespesaBusinessDelegate
   */
  private DespesaBusinessDelegate() {
  }
  
  public static DespesaBusinessDelegate getInstance() {
    if (instance == null)
      instance = new DespesaBusinessDelegate();
    
    return instance;
  }

  public String getJndiName() {
    return null;
  }

  public void delete(Despesa despesa) throws BusinessDelegateException {
    service.delete(despesa);
  }

  public Collection<Despesa> findAll() throws BusinessDelegateException {
    return service.findAll();
  }

  public Despesa findById(Integer id) throws BusinessDelegateException {
    return service.findById(id);
  }

  public Integer insert(Despesa despesa) throws BusinessDelegateException {
    return service.insert(despesa);
  }

  public void update(Despesa despesa) throws BusinessDelegateException {
    service.update(despesa);
  }
  
}
